<?php
	include("../includes/main_inc.php");
	
	if($_POST['Delete']=="Delete"){
		if(is_array($_POST['DFiles'])){
			$m= new DeleteFromDatabase();
			$m->AddIDArray($_POST['DFiles']);
			$m->AddTable("administrators");
			$Errors=$m->DoDelete();
			
			if($Errors==""){
				$Message="Administrators Deleted";
			}else{
				$Message=$Errors;
			};
		}else{
			$Message="No Administrators Selected To Delete";
		};
	};
	
	
?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Affiliate Bubble Administration</title>

<link href="<?=$rootdir?>css/admin.css" rel="stylesheet" type="text/css">
<script src="<?=$rootdir?>jscript/menuArray.js" language="javascript"></script>
<script src="<?=$rootdir?>jscript/clock.js" language="javascript"></script></head>

<body onLoad="funClock();">
<?php include("../includes/header.php"); ?>
<table width="100%" border="0" cellspacing="25" cellpadding="0">
<tr>
<td valign="top" width="240"><div id="menu">
  <?php include("../menu/administratorsmenu.php"); ?>
</div></td>
<td align="center" valign="top">

<div id="titleCompact"> Administrators
</div>

<div id="contentCompact">
<?=$Message;?>
  <form name="form1" method="post" action="view.php">
    <table width="600" border="0" cellpadding="5" cellspacing="1" bgcolor="#E9EEF5">
      <tr id="formHeader">
        <td><strong>Administrators Name </strong></td>
        <td align="center"><strong>Email</strong></td>
        <td width="70" align="center"><strong>Options</strong></td>
        <td width="70" align="center"><strong>Delete</strong></td>
      </tr>
      <?php
	$Count=0;
	$r=new ReturnRecord();
	$sq2=$r->rawQuery("SELECT id,name,email FROM administrators");  
	while ($myrow = mysql_fetch_row($sq2)) {
?>
      <tr bgcolor="<?=(($Count%2)==0 ? "#FFFFFF" : "#EBEBEB"); ?>">
        <td><?=$myrow[1];?></td>
        <td align="center"><?=$myrow[2];?></td>
        <td align="center"><a href="modify.php?id=<?=$myrow[0];?>">Modify</a></td>
        <td align="center"><input type="checkbox" name="DFiles[]" value="<?=$myrow[0];?>"></td>
      </tr>
      <?
		$Count++;
	};
?>

      <tr>
        <td bgcolor="#FFFFFF">&nbsp;</td>
        <td align="center" bgcolor="#FFFFFF">&nbsp;</td>
        <td align="center" bgcolor="#FFFFFF">&nbsp;</td>
        <td align="center" bgcolor="#FFFFFF"><input name="Delete" type="submit" id="Delete" value="Delete" class="formButtonSubmit"></td>
      </tr>
    </table>
      </form>
  </div>

</td>
</tr>
</table>
</body>
</html>
